home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / russell / russell.lha / examples / print.r < prev    next >
Text File  |  1989-12-29  |  939b  |  37 lines

  1. let
  2.     to_ChStr == func[x: val Short] {ChStr$In[x + Out["0"]]};
  3.     base == Short$10;
  4.     print1 == func[x: val Long] val Void {
  5.                   use Long in
  6.                     if 
  7.                       x > 0 ==> print1[x/base]; put[to_ChStr[x%base]]
  8.                     # x = 0 ==> Null
  9.                     # x < 0 ==> put["-"]; print1[x]
  10.                     fi
  11.                   ni
  12.               };
  13.     print == func[x: val Long] val Void {
  14.                 use Long in
  15.                   if
  16.                     x = 0 ==> put["0"];
  17.                   # else  ==> print1[x];
  18.                   fi
  19.                 ni
  20.              };
  21.     ** == func[x,y: val Long] {
  22.             use Long in
  23.                 if
  24.                     y = 0 ==> 1
  25.                 #   else  ==> x**(y-1) * x
  26.                 fi
  27.             ni
  28.           }
  29. in
  30.     use Long in
  31.         print[12345];
  32.         put["\n"];
  33.         print[2**32];
  34.         put["\n"];
  35.     ni
  36. ni
  37.